<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script type="text/javascript">
        window.onload = function () {
            //js获取cookie的方式
            console.log(document.cookie);
            //string
            console.log(typeof document.cookie);
            var cookieStr = document.cookie;
            var cookieArr = cookieStr.split("; ");
            var usernameValue = null;
            var passwordValue = null;
            var isRemember = false;
            for (let i = 0; i < cookieArr.length; i++) {
                var cookieTinyArr = cookieArr[i].split("=");
                var name = cookieTinyArr[0];
                var value = cookieTinyArr[1];
                if ("username" == name){
                    usernameValue = value;
                    continue;
                }
                if ("password" == name){
                    passwordValue = value;
                    continue;
                }
                if ("rememberme" == name){
                    isRemember = true;
                    continue;
                }
            }
            if (isRemember){
                document.getElementById("username").value = usernameValue;
                document.getElementById("password").value = passwordValue;
                document.getElementById("rememberme").checked = 'checked';
            }
        }
    </script>
</head>
<body>
<form method="get" action="./login03.do">
    用户名:<input id="username" name="username" type="text"/><br>
    密码:<input id="password" name="password" type="password"/><br>
    <input id="rememberme" type="checkbox" name="rememberme">记住我<br>
    <button type="submit">提交</button>
</form>
</body>
</html>